package com.mti.app.model
{
	import com.mti.app.ApplicationFacade;
	import com.mti.app.model.business.EvenementObject;
	import com.mti.app.model.business.LoadXMLDelegate;
	
	import mx.controls.Alert;
	import mx.rpc.IResponder;
	
	import org.puremvc.as3.interfaces.IProxy;
	import org.puremvc.as3.patterns.proxy.Proxy;
	
	public class ChoiceProxy extends Proxy implements IProxy, IResponder
	{
		public static const NAME:String = "ChoiceProxy";
		private var res:EvenementObject;		
		public function ChoiceProxy()
		{
			super(NAME);
		}
		
		public function load(choiceName:String):void
		{
			res = new EvenementObject(choiceName);
			var delegate:LoadXMLDelegate = new LoadXMLDelegate(this, 'assets/menu.xml');
			delegate.load();
		}
		
		public function result(data:Object) : void
		{
			
			sendNotification(ApplicationFacade.LOADING_CHOICE_COMPLETE, res);
			
		}
		
		public function fault(info:Object):void
		{
			Alert.show(ApplicationFacade.ERROR_LOAD_FILE);
		}
		
	}
}